#include "../ControlUI/UI.hpp"
#include <unistd.h>
#include <spdlog/spdlog.h>
#include <array>

std::array<std::tuple<std::string,long,std::string>,10> arrList={
  std::make_tuple<std::string,long,std::string>("测试用例1",1,"男"),
  std::make_tuple<std::string,long,std::string>("测试用例2",2,"男"),
  std::make_tuple<std::string,long,std::string>("测试用例3",3,"男"),
  std::make_tuple<std::string,long,std::string>("测试用例4",4,"男"),
  std::make_tuple<std::string,long,std::string>("测试用例5",5,"男"),
  std::make_tuple<std::string,long,std::string>("测试用例6",6,"男"),
  std::make_tuple<std::string,long,std::string>("测试用例7",7,"男"),
  std::make_tuple<std::string,long,std::string>("测试用例8",8,"男"),
  std::make_tuple<std::string,long,std::string>("测试用例9",9,"男"),
  std::make_tuple<std::string,long,std::string>("测试用例10",10,"男"),
};
int ptrArrList=0;

int main()
{
  UI ui;
  ui.funcPage1Ready=[](const std::string& proj,const std::string& name){
    spdlog::info("funcPage1Ready: {} {}",proj,name);
  };
  ui.funcGetLastPeople=[](){
    if(ptrArrList==0)
      throw "已经是第一个运动员了";
    ptrArrList--;
    return arrList[ptrArrList];
  };
  ui.funcGetNextPeople=[](){
    if(ptrArrList==arrList.size()-1)
      throw "已经是最后一个运动员了";
    ptrArrList++;
    return arrList[ptrArrList];
  };
  ui.funcGetCurrentPeople=[](){
    return arrList[ptrArrList];
  };
  ui.funcGetRecordInfo=[](){
    return std::make_tuple<>(
      std::string("测试用例"),
      std::string("长拳"),
      long(ptrArrList),
      long(arrList.size())
    );
  };
  
  ui.Boot();
}
